<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" ></meta>
    <link rel="stylesheet" type="text/css" th:href="@{/common/css/login.css}">
    <link rel="shortcut icon" th:href="@{/favicon.ico}" type="image/x-icon" />
    <link rel="stylesheet" th:href="@{/layui/css/font.css}">
	<link rel="stylesheet" th:href="@{/layui/css/xadmin.css}">
    <script type="text/javascript" th:src="@{/easyui1.4.2/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/layui/js/xadmin.js}"></script>
    <script type="text/javascript" th:src="@{/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/layui/vue.min.js}" charset="utf-8"></script>
</head>
<body class="login-bg">
    
    <div class="login" id="app">
        <div class="message">{{solgan}}</div>
        <div id="darkbannerwrap" th:if="${param.error}">
        	<div th:if="${session.SPRING_SECURITY_LAST_EXCEPTION}">
        		<span th:text="${session.SPRING_SECURITY_LAST_EXCEPTION.message}"></span>
			</div>
        </div>
        
        <form class="layui-form" id="loginForm" th:action="@{/login}" method="post">
            <input  v-model="username" name="username" placeholder="账号"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input  v-model="password" name="password" placeholder="密码"  type="password" lay-verify="required" class="layui-input">
            <hr class="hr15">
            <input value="登录" style="width:100%;" type="button" @click="login">
            <hr class="hr20" >
        </form>
    </div>
<!-- 底部结束 -->
</body>

<script type="text/javascript" th:inline="javascript">
var vm = new Vue({
	el:'#app',
	data:{
		solgan:'SUN-SHOWCASE',
		username: '',
		password: '',
		error: false,
		errorMsg: '',
	},
	beforeCreate: function(){
		if(self != top){
			top.location.href = self.location.href;
		}
	},
	methods: {
		login: function (event) {
			var data = "name="+vm.username+"&password="+vm.password;
			if(!vm.username){
				vm.errorMsg="请输入用户名";
				return;
			}
			if(!vm.password){
				vm.errorMsg="请输入密码";
				return;
			}
			document.getElementById("loginForm").submit();
		}
	}
});
</script>